UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ag2Ucsc/czporUO4qZWdJ5O4JUeaf5EFZnKKzLkz888='
WHERE
key_id = '0d48e196174269804b74b0e8e603a88dc206f9e6a22b25538b1d8914a2a15455'
AND (
token = 'Ag2Ucsc/czporUO4qZWdJ5O4JUeaf5EFZnKKzLkz888='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)