UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ttACxgrud12yBDwvgdOMj/I/EhPtFepXIhPN/eVZk9E='
WHERE
key_id = '0f8964da1542b5f5b8b3b83f3ff4e250b45525a4dff3a13db45303d3c793199e'
AND (
token = 'ttACxgrud12yBDwvgdOMj/I/EhPtFepXIhPN/eVZk9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)