UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/13nszf87MlzzD8etTsAMLIIz1Tf6P4WVEV+XwS8YI=' 
WHERE 
  key_id = '881654374ca7d18fdab148708f356e448f6fe5476d2384eb088ce5726f957d95' 
  AND (
    token = 'I/13nszf87MlzzD8etTsAMLIIz1Tf6P4WVEV+XwS8YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042