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

Query time 0.00034