UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nQtcDimQ39XinYkul/VNcvTRZBvvU2RnN+rItX7XX3w='
WHERE
key_id = '51d315c69c726e3b4f0f3414f4d67788bab8bab1c0815518128b6f3b912b794e'
AND (
token = 'nQtcDimQ39XinYkul/VNcvTRZBvvU2RnN+rItX7XX3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)