UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EK+wUhHmeB7rFPm3GrRcyIguxfmdJBNousddHZ55YIg='
WHERE
key_id = 'b8fb0f141492ddc951c505c26f4b18fff12b52920a4d5ebd3c6095cda5642642'
AND (
token = 'EK+wUhHmeB7rFPm3GrRcyIguxfmdJBNousddHZ55YIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)