UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B71lVudbV8u+i/us50nvoW1Q7EOGefmOmX20hmQCglw='
WHERE
key_id = 'f8464b6c72b7e1af1ae969aeaf84d18856dcc7ac7a11f27da3885ae6b492e92d'
AND (
token = 'B71lVudbV8u+i/us50nvoW1Q7EOGefmOmX20hmQCglw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)