UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/OpaQU5pO1zvxpmahDdhfkkk2jMUDjYIa+zEGpXFohQ=' 
WHERE 
  key_id = 'a248cda1e8ba343031b0279208546489dbfa864312d896e02da0dc8559cb37cb' 
  AND (
    token = '/OpaQU5pO1zvxpmahDdhfkkk2jMUDjYIa+zEGpXFohQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073