UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q4nrW/XRx5XUvsWBmCzcRnnlbmTHPyd4xtKqKCJPQ5o='
WHERE
key_id = '40edc74323842c9becd7dde8a0c7ed01329931af29deffa74af0ff6e932d05a3'
AND (
token = 'Q4nrW/XRx5XUvsWBmCzcRnnlbmTHPyd4xtKqKCJPQ5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)