UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WvfvTMmkgbaw8k6L5NtYPLp7ka/k4S50KGn+X8Vhnk4=' 
WHERE 
  key_id = '393a11c5c2e26593ef8538c1abb26811aec5d7301aa89822ef5d03c3ab3e1167' 
  AND (
    token = 'WvfvTMmkgbaw8k6L5NtYPLp7ka/k4S50KGn+X8Vhnk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032