UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ch1od0rPI0zm/jhM+ufIi8Ru0SaERwBR1KhUPWLuBZk=' 
WHERE 
  key_id = '8d67288a7cf36fbf92bd4d236f35fb319f7d94894cea4fffcc69fa0171108db2' 
  AND (
    token = 'Ch1od0rPI0zm/jhM+ufIi8Ru0SaERwBR1KhUPWLuBZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040