UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G8taqFKNTkP3I8lgMjheYiP8sb8scgGNlpQGiDXvO6g='
WHERE
key_id = '51c821101b79af6e313c832e4d6c4cf6349893773950c1869b53c075ff4df7df'
AND (
token = 'G8taqFKNTkP3I8lgMjheYiP8sb8scgGNlpQGiDXvO6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)