UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BWgWOcQaZnnrFikHktrSpK96DtThQVjMWlYii/lE4u0=' 
WHERE 
  key_id = 'b13188d76a408eceaa258bda3282263d482cc29ff06c4800856a2e716f7a9522' 
  AND (
    token = 'BWgWOcQaZnnrFikHktrSpK96DtThQVjMWlYii/lE4u0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049