UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKIPjPiRaBlDgBQAY9E1HiS35DY1eXh8arD/ciU5nGg=' 
WHERE 
  key_id = 'c31c03f3986ab11fdf656e718bd2f076dc38c25628124bb3467e29b1e77cd973' 
  AND (
    token = 'KKIPjPiRaBlDgBQAY9E1HiS35DY1eXh8arD/ciU5nGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024