UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y8bZL4i8dVCcFiic0xoMVLuXprYibEF60ETIvuFjeyM=' 
WHERE 
  key_id = '0fad4a3354b04a112f9ffd0da395937ac2917316332e555b4241bec9b1558631' 
  AND (
    token = 'Y8bZL4i8dVCcFiic0xoMVLuXprYibEF60ETIvuFjeyM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055