UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iytFge4c29opZKEI3Oq849N1L011ZKDtoJOvvdr2gBY=' 
WHERE 
  key_id = '2270f7481ccf041fd88cad4bdbc7d8b25e4aa619a7421a5eabfbb9d632c473aa' 
  AND (
    token = 'iytFge4c29opZKEI3Oq849N1L011ZKDtoJOvvdr2gBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023