UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7JYv79qrmQSzBiH7imcf1JVosBjl//a0VEB08Cg2Hr0='
WHERE
key_id = 'e21348b5ccefb94c482a76dc2b60ec605abe45b03accdd1caceadb8d92aa78b3'
AND (
token = '7JYv79qrmQSzBiH7imcf1JVosBjl//a0VEB08Cg2Hr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)