UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vgjOH2MbtMn6LShpYSt1jbs3Vrnu523iqoRYetBxmbA='
WHERE
key_id = '821476a0888e82590e9e48f403af87ae9a51458a1136a525addc3e2ac4524d44'
AND (
token = 'vgjOH2MbtMn6LShpYSt1jbs3Vrnu523iqoRYetBxmbA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)