UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qweEkfajhLoEmskuG21cyUZYdGLuJ/nBfF1Pdjuq0/M=' 
WHERE 
  key_id = 'a8d6db33dec81501427379541a1c2b702e411148716bcd3f2909fe42ed18aad2' 
  AND (
    token = 'qweEkfajhLoEmskuG21cyUZYdGLuJ/nBfF1Pdjuq0/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039