UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jnUJFTWlqHGOP3xyOaK+2Lb099MduX4ZTKYkvK1oeus='
WHERE
key_id = 'f56fc5f52257b25f83167857770917e7662c752c994d12d3ed53778db23fd370'
AND (
token = 'jnUJFTWlqHGOP3xyOaK+2Lb099MduX4ZTKYkvK1oeus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)