UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x4hFDxQdNkvfQ/9G0tZbDfCggGsHi4sFdocKccphrVI='
WHERE
key_id = 'a562bac0be1a7ce17b2bd03bc363912282b41bc93d5b9027a13e949cf6b7b1a7'
AND (
token = 'x4hFDxQdNkvfQ/9G0tZbDfCggGsHi4sFdocKccphrVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)