UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S5URkuYf96mSJGt2auVqBxrtWRCDBt70qSqfYN5Ytcg=' 
WHERE 
  key_id = '8c31aa1f88109568af43f433cd426252e727764605bd82993888da104267a829' 
  AND (
    token = 'S5URkuYf96mSJGt2auVqBxrtWRCDBt70qSqfYN5Ytcg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032