UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R8zcIi6qX83is0+uF58YPiHPGcEm6J5d2DEpVGV9KfY='
WHERE
key_id = '315321659472233a77148fd014370624bc840f08c077809a9a040ee5fb7088ad'
AND (
token = 'R8zcIi6qX83is0+uF58YPiHPGcEm6J5d2DEpVGV9KfY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)