UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wIduq1LQ1DIbNBprqL5nA4Myw1J8GriadyrxG87/OA8='
WHERE
key_id = 'dbf299a6a02ad8499050bd10f758f5badc46a1cbf846aa7205648f59e3b38818'
AND (
token = 'wIduq1LQ1DIbNBprqL5nA4Myw1J8GriadyrxG87/OA8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)