UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3piGtBjHUO6xtEJgoisS9AiTx31G/IR6G9f2YgOxGYw='
WHERE
key_id = '4f2f2bdac650b5277b7a6e26ea312e2d306d821298729b38f2199befb5dc8508'
AND (
token = '3piGtBjHUO6xtEJgoisS9AiTx31G/IR6G9f2YgOxGYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)