UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ibI/6HpB3d6qOEOvl2A36KLXJuiSxRq5FcD9FOuNy+k=' 
WHERE 
  key_id = 'a177b8683ca65272b1b776d3cec61a66bb0f153b000b8c130662a026e121e19f' 
  AND (
    token = 'ibI/6HpB3d6qOEOvl2A36KLXJuiSxRq5FcD9FOuNy+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046