UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vgORmTAukthvtn/J06TI8hsV4d7r35mbdSSce7HiJig=' 
WHERE 
  key_id = 'a73221bedc504c69e7b9e7cbce674bca3d8145a5f33ff4f1a8514450230d97ea' 
  AND (
    token = 'vgORmTAukthvtn/J06TI8hsV4d7r35mbdSSce7HiJig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042