UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ljZ8Bj1kkmv4VWjwXGV+fihTvBxv3MD+X7C+xARjrdg=' 
WHERE 
  key_id = '7ca48309365bb8251f508dc62b4084285e047ce0d0c24419c828cc8374fd7101' 
  AND (
    token = 'ljZ8Bj1kkmv4VWjwXGV+fihTvBxv3MD+X7C+xARjrdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034