UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ijuQFZo84L2sVGGkS2WKznyctl6w7FjqVm7SzHs79tw='
WHERE
key_id = '94f87476e1eb03293ec006a9bb4c82dcb6b34ddf0e47b8a3dd7e35ff35a28728'
AND (
token = 'ijuQFZo84L2sVGGkS2WKznyctl6w7FjqVm7SzHs79tw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)