UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E/S9C4CQgxT3baflZ0zjM0HDql6krhW0CNDQnrAAeXs='
WHERE
key_id = 'f45cf7c2c598eafcbedd293e768ef7937ee8f3b31e4332e61d9fdc3c134a6bfd'
AND (
token = 'E/S9C4CQgxT3baflZ0zjM0HDql6krhW0CNDQnrAAeXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)