UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q0QXkUlLq2zGvVqasmXsy0AvYusKY+J2FfASNPn3RV0='
WHERE
key_id = '04054eb5f4246a6e69aef02f02d8202cc98f8b2739374871307e59ba7a7dcc4c'
AND (
token = 'q0QXkUlLq2zGvVqasmXsy0AvYusKY+J2FfASNPn3RV0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)