UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7AlnK5VxMjkEepi8JeQ1FATs91gdiBhwYyR1wDwBGKo=' 
WHERE 
  key_id = '7516c3c7661dc2d9e3001ab65f8a2f0f667b4c562fa00f0878054df8814b867d' 
  AND (
    token = '7AlnK5VxMjkEepi8JeQ1FATs91gdiBhwYyR1wDwBGKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045