UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7j2Cj3V5SlwPCJNEyTt8zhFFOVzMADH2OgPqrhopvas='
WHERE
key_id = '2c7d46fa4507ed1af2b674b6b035a823537827d5d8c2736017ca3402a1761944'
AND (
token = '7j2Cj3V5SlwPCJNEyTt8zhFFOVzMADH2OgPqrhopvas='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)