UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'COoNXxm3el6GQ/hJhbOoBo3wSoIBHxLRVLvnE1fgqj4='
WHERE
key_id = '5906c6e0bce6286f3043d5417630672a5b1c14efcdc862cb590824ab8750196e'
AND (
token = 'COoNXxm3el6GQ/hJhbOoBo3wSoIBHxLRVLvnE1fgqj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)