UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M22Ds3v/WLczwTxJ5iswNuB0dZESow46/i9YFRRNgyI=' 
WHERE 
  key_id = '46d4814b24693ca8421576751958cfea87be825ca1d7f08393a2f44dabd153d8' 
  AND (
    token = 'M22Ds3v/WLczwTxJ5iswNuB0dZESow46/i9YFRRNgyI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028